#ifndef CCOPYFILEWIDGET_H
#define CCOPYFILEWIDGET_H

#include "../Common/CMyFileSystem.h"
#include "../Common/CMyWindow.h"

#include <QListWidgetItem>
#include <QWidget>

enum EnumInfoType {
    eSuccess,
    eWarning,
    eError,
    eInfo,
    eText,  // 仅显示普通文本
};

namespace Ui {
class CCopyFileWidget;
}

class QDir;
class CCopyFileWidget : public CMyWindow {
    Q_OBJECT

  public:
    virtual void LoadSize(QWidget* parent) override;
    virtual void SaveSize(QWidget* parent) override;
    virtual QMenuBar* GetMenuBar() override;
    virtual int GetComponentId() override;

  public:
    explicit CCopyFileWidget(QWidget* parent = nullptr);
    ~CCopyFileWidget();

    void SaveFile();
    void LoadFile();

  private slots:
    void on_copyFileWidget_itemClicked(QListWidgetItem* item);
    void slotCopyFileChanged(const QString& path);
    void slotCopyFileDirectoryChanged(const QString& path);

    void slotUiCopyFileChanged(const QString& path);
    void slotUiCopyFileDirectoryChanged(const QString& path);

    void on_tbTargetPath_clicked();
    void on_tbSrcPath_clicked();
    void on_tbUiTargetPath_clicked();
    void on_tbUiSrcPath_clicked();
    void on_btnRefreshCopyFileSrc_clicked();
    void on_btnExecCopyFile_clicked();
    void on_cbCopyFileWatch_clicked();
    void on_btnClearInfo_clicked();
    void on_cbUiCopyFileWatch_clicked();
    void on_tbZXPSelect_clicked();
    void on_tbCertificateSelect_clicked();
    void on_btnRefreshUiCopyFileSrc_clicked();
    void on_btnExecUiCopyFile_clicked();

  private:
    void ShowInfo(const QString& str, EnumInfoType type);
    void UpdateCopyFileSrcList(const QString& path);
    void UpdateUiCopyFileSrcList(const QString& path);
    void GetAllFileDirector(const QDir& dir, QStringList& fileList);
    void ExecutUI(const QString& filename);

  private:
    Ui::CCopyFileWidget* ui;

    static QString s_strFileName;

    CMyFileSystem m_copyFileSystem;
    CMyFileSystem m_uiCopyFileSystem;
};

#endif  // CCOPYFILEWIDGET_H
